{% for item in syslog_facilities | selectattr('enabled') %}
<match syslog.{{ item.facility }}.**>
  @type copy
  <store>
    @type file
    path /var/log/kolla/{{ item.logdir }}/{{ item.logfile }}
    append true
    # Disable timestamp in filename for logs
    <buffer []>
      path /var/log/kolla/{{ item.logdir }}/{{ item.logfile }}.*.buffer
    </buffer>
    <format>
      output_tag {{ item.output_tag | default(false) | lower }}
      output_time {{ item.output_time | default(false) | lower }}
    </format>
  </store>
{% if log_direct_to_elasticsearch %}
  <store>
       @type elasticsearch
       host {{ elasticsearch_address }}
       port {{ elasticsearch_port }}
       scheme {{ fluentd_elasticsearch_scheme }}
{% if fluentd_elasticsearch_path != '' %}
       path {{ fluentd_elasticsearch_path }}
{% endif %}
{% if fluentd_elasticsearch_scheme == 'https' %}
       ssl_version {{ fluentd_elasticsearch_ssl_version }}
       ssl_verify {{ fluentd_elasticsearch_ssl_verify }}
{% if fluentd_elasticsearch_cacert | length > 0 %}
       ca_file {{ fluentd_elasticsearch_cacert }}
{% endif %}
{% endif %}
{% if fluentd_elasticsearch_user != '' and fluentd_elasticsearch_password != ''%}
       user {{ fluentd_elasticsearch_user }}
       password {{ fluentd_elasticsearch_password }}
{% endif %}
       logstash_format true
       logstash_prefix {{ kibana_log_prefix }}
       reconnect_on_error true
       request_timeout {{ fluentd_elasticsearch_request_timeout }}
       suppress_type_name true
       <buffer>
         @type file
         path /var/lib/fluentd/data/elasticsearch.buffer/{{ item.facility }}.*
         flush_interval 15s
       </buffer>
  </store>
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
  <store>
     @type monasca
     keystone_url {{ keystone_internal_url }}
     monasca_api {{ monasca_log_api_internal_endpoint }}
     monasca_api_version v2.0
     username {{ monasca_agent_user }}
     password {{ monasca_agent_password }}
     domain_id default
     project_name {{ monasca_control_plane_project }}
     message_field_name Payload
     max_retry_wait 1800s
     disable_retry_limit true
     <buffer>
       @type file
       path /var/lib/fluentd/data/monasca.buffer/{{ item.facility }}.*
       chunk_limit_size 8m
     </buffer>
  </store>
{% endif %}
</match>
{% endfor %}
